package nc.bs.common.util;

import nc.bs.dao.BaseDAO;
import nc.bs.dao.DAOException;
import nc.jdbc.framework.processor.BeanListProcessor;
import nc.vo.bd.defdoc.DefdocVO;

import java.util.List;

/**
 * @author duanyp1
 * @date 2024/1/18 13:57
 */
public class DefDocQueryUtil {

    public static DefdocVO[] queryDefDocByListCode(String code) {
        BaseDAO dao = new BaseDAO();
        String sql = "SELECT * FROM bd_defdoc where dr = 0 and enablestate = 2and pk_defdoclist = " +
                " (SELECT pk_defdoclist FROM bd_defdoclist where dr = 0 and enablestate = 2 and code = '" + code + "') ";
        List<DefdocVO> rs = null;
        try {
            rs = (List<DefdocVO>) dao.executeQuery(sql, new BeanListProcessor(DefdocVO.class));
        } catch (DAOException e) {
            e.printStackTrace();
        }
        return rs != null ? rs.toArray(new DefdocVO[0]) : null;
    }


}
